package com.choichumgming.rentcat.component;

import com.choichumgming.rentcat.service.OmsBuyerOrderService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 取消订单消息的处理者
 */
@Slf4j
@Component
@RabbitListener(queues = "rentcat.order.cancel")
public class CancelOrderReceiver {
    @Autowired
    private OmsBuyerOrderService omsBuyerOrderService;
    @RabbitHandler
    public void handle(Long orderId){
        omsBuyerOrderService.cancelOrder(orderId);
        log.info("process orderId:{}",orderId);
    }
}
